package com.isunland.managesystem.ui;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import com.isunland.managesystem.R;

public class SignOutsideFragment extends DialogFragment {
  @SuppressWarnings("unused") private static final String TAG = "SignOutsideFragment";
  @SuppressWarnings("unused") private int mInternalTime;

  @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
    mInternalTime = getArguments().getInt("internal_time");
    return new AlertDialog.Builder(getActivity()).setTitle(R.string.trackOutside)
        // .setMessage(R.string.trackOutside)
        .setNegativeButton(R.string.stop, new OnClickListener() {

          @Override public void onClick(DialogInterface dialog, int which) {
            //						getLocation(false);

          }
        }).setPositiveButton(R.string.start, new OnClickListener() {

          @Override public void onClick(DialogInterface dialog, int which) {
            //						getLocation(true);

          }
        }).create();
  }

  //	public void getLocation(boolean isOn) {
  //		boolean shouldStartAlarm = !BDLocationService
  //				.isServiceAlarmOn(getActivity());
  //		if (isOn && shouldStartAlarm) {
  //			BDLocationService
  //					.setServiceAlarm(getActivity(), true, mInternalTime);
  //			Toast.makeText(getActivity(), R.string.hint_start_location_service,
  //					Toast.LENGTH_SHORT).show();
  //
  //		}
  //		if (!isOn && !shouldStartAlarm) {
  //			BDLocationService.setServiceAlarm(getActivity(), false,
  //					mInternalTime);
  //			Toast.makeText(getActivity(), R.string.hint_stop_location_service,
  //					Toast.LENGTH_SHORT).show();
  //		}
  //	}

  public static SignOutsideFragment newInstance(int interalTime) {
    Bundle args = new Bundle();
    args.putInt("internal_time", interalTime);
    SignOutsideFragment fragment = new SignOutsideFragment();
    fragment.setArguments(args);
    return fragment;
  }
}
